package com.yangchao.webflux.threadingAndSchedulers;

import com.yangchao.webflux.projectreactor.MonoTest;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

import java.time.Duration;

public class ThreadTest {

    static Logger logger = org.slf4j.LoggerFactory.getLogger(MonoTest.class);

    @Test
    @DisplayName("线程池测试 01")
    public void threadPoolTest() throws InterruptedException {
        final Mono<String> mono = Mono.just("hello ");
        Thread t = new Thread(() -> mono
                .map(msg -> msg + "thread ")
                .subscribe(v ->
                        logger.info(v + Thread.currentThread().getName())
                )
        );
        t.start();
        t.join();
    }

    @Test
    @DisplayName("线程池测试 02")
    public void threadPoolTest02() throws InterruptedException {

    }
}
